<%@ page language="java" 
    pageEncoding="utf-8"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理员登陆</title>

<link href="css/main_admin.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

</head>
<body>


<div class="login">
    <div class="box png">
		<div class="logo png"></div>
		<div class="input">
			<div class="log">
				<!-- <form class="form-signin" action="login" method="post"> -->
					<form method="post" id="signupForm">
					<label for="adminName">用户名</label>
					<input type="text" class="text" id="adminName" placeholder="用户名" name="adminName" tabindex="1">			
					<label for="adminPwd">密　码</label>
					<input type="password" class="text" id="adminPwd" placeholder="密码" name="adminPwd" tabindex="2">
					
					<div class="checkbox" style="margin-left: 10%;margin-top: 10px;">
                    </div>
					 <button class="btn  btn-primary " id="loginBtn" name="loginBtn" style="margin-left:150px;margin-top: 10px;" >登录</button>
                  	
					<div class="check"></div>
				 <!-- </form> -->
					<div class="tip" id="msg"> <label id="msg"></label></div>
					</form>
			</div>
		</div>
	</div>
    <div class="air-balloon ab-1 png"></div>
	<div class="air-balloon ab-2 png"></div>
    <div class="footer"></div>
</div>

<script type="text/javascript" src="js/jQuery.js"></script>
<script type="text/javascript" src="js/fun.base.js"></script>
<script type="text/javascript" src="js/script.js"></script>


<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>

<script type="text/javascript">
$("#loginBtn").click(function (){
	
	$.ajax({
		url:'login',
		type:'POST',
	    dataType:'json',
		contentType:'application/json',
		data:JSON.stringify({"adminName":$("#adminName").val(),"adminPwd":$("#adminPwd").val()}),
	    success: function (ret) {  

          
            if(ret.status=='ok'){ 
            	  $("#msg").html("登录成功！");
            	var href = '${pageContext.request.contextPath}/index_admin.jsp';
                window.top.location.href = href;
            }
            else if(ret.status=='userNameOrPwdError'){        	
            	 //$("#msg").html("登录失败");
            	alert("登录失败");
            }
    
    }
	});
});	


</script>
</html>